var serviceHttp = 'http://www.ihengtian.top:8101/';

// var shop_before = '/api/cft/shop';
var query_mine_info = '/query/mine/info';

var organ_before = '/api/cft/organ';
var query_job_level = '/shop/job/level/config';
var query_stuff='/query/below/stuffs';

var indexApp = angular.module('myApp', []);


indexApp.controller("myCtrl", function($http, $scope, $location) {

    $http({  
    	method:'post',  
   		url:serviceHttp + organ_before + query_mine_info,  
    	data:{token:"ELGBLELDMCC"}  
		}).success(function(response){  
			$scope.mine = response.data;
    		console.log(response);  
		})  
	
	$http({  
    	method:'post',  
   		url:serviceHttp + organ_before + query_job_level,  
    	data:{token:"ELGBLELDMCC"}  
		}).success(function(response){  
			$scope.jobs = response.data;
    		console.log(response);  
		})  

	$scope.queryStuffs = function(token,id) {
        $http({  
    	method:'post',  
   		url:serviceHttp + organ_before + query_stuff,  
    	data:{token:token,id:id}  
		}).success(function(response){  
			$scope.stuffs = response.data;
			$scope.message=response.message;
    		console.log(response);  
		}) 
    };

    $scope.addStuff = function(token,shopId,level) {
    	if (level<=1) {
    		alert("您已经低无可低了！");
    	}else{
    		window.location.href = "stuff?token=" +token+"&shopId="+shopId;
    	}
        
    };
});